import { getSingleClass } from '../utils/es'
class CesiumImageryLayerController {
  constructor(viewer) {
    this.viewer = viewer
  }
  toggleImageryLayer(layer, show) {
    const { imageryLayers } = this.viewer
    if (imageryLayers.contains(layer)) {
      if (show) {
        imageryLayers.raiseToTop(layer)
      }
      layer.show = show
    } else {
      imageryLayers.add(layer)
    }
  }
}

export const cesiumImageryLayerControllerSingle = getSingleClass(CesiumImageryLayerController)
